<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const ws = new WebSocket('ws://localhost:3000');
        ws.addEventListener('open',()=>{
            console.log('连接上服务器了')

            ws.send('你好')
        });

        ws.addEventListener('message',({data })=>{
            console.log('收到消息', data);
        })

    
    </script>
    
</body>
</html>
